<template>
  <div>
    <!-- 三级导航 -->
    <typeNav />
    <!-- 中间轮播图和快报 -->
    <list />
    <!-- 今日推荐 -->
    <recommend />
    <!-- 热卖排行 -->
    <rank />
    <!-- 猜你喜欢 -->
    <like />
    <!-- 家用电器楼层 -->
    <floor v-for="item in floorList" :key="item.id" :list="item" />
    <!-- 底部品牌商logo -->
    <brand />
  </div>
</template>

<script>
import list from '@/page/home/list/list.vue'
import recommend from '@/page/home/recommend/recommend.vue'
import rank from '@/page/home/rank/rank.vue'
import like from '@/page/home/like/like.vue'
import floor from '@/page/home/floor/floor.vue'
import brand from '@/page/home/brand/brand.vue'
import { mapState } from 'vuex'
export default {
  name: '',
  components: {
    list,
    recommend,
    rank,
    like,
    floor,
    brand,
  },
  computed: {
    ...mapState('home', ['floorList']),
  },
  created() {
    //   let token = localStorage.getItem('TOKEN')
    //   console.log(token)
    //   if (token) {
    //     this.$store.dispatch('register/getUserInfo')
    //   } else {
    //     return alert('没有token不能派发actions')
    //   }
    // 发送请求拿三级联动数据
    if (this.$route.meta.getnavlist) {
      this.$store.dispatch('home/getcategoryList')
    }
  },
}
</script>

<style></style>
